package models;

import play.db.jpa.GenericModel;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;

@Entity
@Table(name = "Files")
public class FileInfo extends GenericModel{

    @Id
    @Column(name = "id", length = 50)
    public String id;

    @Column(name = "fileName", length = 50)
    public String fileName;

    @Column(name = "fileSize")
    public long fileSize;

    @Column(name = "fileType", length = 50)
    public String fileType;

    public FileInfo(String id, String name, long size, String type) {
        this.id = id;
        this.fileName = name;
        this.fileSize = size;
        this.fileType = type;
    }

    public FileInfo() {
    }

    @Override
    public boolean equals(Object obj) {
        if (!(obj instanceof FileInfo))
            return false;

        FileInfo info = (FileInfo) obj;
        return this.fileName.equals(info.fileName) && this.fileSize == info.fileSize && this.fileType.equals(info.fileType);
    }
}
